﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GMusicBox.Core
{
    public class DownloadTask
    {
        public DownloadTask(Song s)
        {
            Song = s;
        }

        public string FileName { get; set; }
        public bool IsCompleted { get; set; }
        public bool IsDownloading { get; set; }
        public bool IsLyrics { get; set; }
        public Song Song { get; private set; }

        public string ToXML(int Indent)
        {
            string indent = "";
            string body = "";
            for (int i = 0; i < Indent; i++) indent += "\t";
            body += indent + "<download>\r\n"; indent += "\t";
            body += string.Format("{0}<id>{1}</id>\r\n", indent, Song.Id);
            body += string.Format("{0}<saveto>{1}</saveto>\r\n", indent, FileName);
            body += string.Format("{0}<iscomplete>{1}</iscomplete>\r\n", indent, IsCompleted);
            body += string.Format("{0}<isLyrics>{1}</isLyrics>\r\n", indent, IsLyrics);
            body += indent.Substring(0, indent.Length - 1) + "</download>\r\n";
            return body;
        }
    }
}
